<template>
  <div class="about-page">
    <ParticleBackground />
    <div class="container">
      <div class="about-header">
        <h1 class="page-title">关于AI小课堂</h1>
        <div class="title-underline"></div>
      </div>

      <div class="about-content">
        <section class="intro-section">
          <div class="intro-card">
            <div class="icon-wrapper">
              <span class="icon">🎯</span>
            </div>
            <h2>我们的使命</h2>
            <p>
              AI小课堂致力于为每个人提供通俗易懂的人工智能知识，让AI技术不再神秘，
              帮助大家在AI时代找到自己的位置和机会。
            </p>
          </div>

          <div class="intro-card">
            <div class="icon-wrapper">
              <span class="icon">🌟</span>
            </div>
            <h2>我们的愿景</h2>
            <p>
              让人工智能成为每个人的助手，而不是替代者。通过知识分享和实践指导，
              帮助更多人拥抱AI带来的机遇。
            </p>
          </div>

          <div class="intro-card">
            <div class="icon-wrapper">
              <span class="icon">💡</span>
            </div>
            <h2>我们的价值</h2>
            <p>
              简单易懂、实用有效、与时俱进。我们相信知识的力量，
              更相信每个人都有能力掌握AI技术。
            </p>
          </div>
        </section>

        <section class="features-section">
          <h2 class="section-title">平台特色</h2>
          <div class="features-grid">
            <div class="feature-item">
              <span class="feature-icon">📚</span>
              <h3>系统化课程</h3>
              <p>从基础到进阶，循序渐进的学习路径</p>
            </div>
            <div class="feature-item">
              <span class="feature-icon">🎮</span>
              <h3>互动式学习</h3>
              <p>通过实例和互动，让学习更加生动有趣</p>
            </div>
            <div class="feature-item">
              <span class="feature-icon">🚀</span>
              <h3>实战导向</h3>
              <p>注重实际应用，帮助你快速上手AI工具</p>
            </div>
            <div class="feature-item">
              <span class="feature-icon">🤝</span>
              <h3>社区支持</h3>
              <p>与志同道合的学习者一起交流成长</p>
            </div>
          </div>
        </section>

        <section class="team-section">
          <h2 class="section-title">团队介绍</h2>
          <p class="team-intro">
            我们是一群热爱技术、热爱分享的开发者和教育工作者。
            我们相信技术应该服务于人，让生活变得更美好。
          </p>
        </section>

        <!-- 彩蛋入口 - 直接访问 -->
        <div class="easter-egg-trigger" @click="goToProgrammerDay" v-feedback title="1024程序员节">
          <span class="hidden-icon">🎉</span>
        </div>
      </div>

      <!-- 密码输入对话框 -->
      <transition name="modal-fade">
        <div v-if="showDialog" class="modal-overlay" @click="closeDialog">
          <div class="modal-content" @click.stop>
            <button class="close-btn" @click="closeDialog">&times;</button>
            <div class="modal-header">
              <span class="lock-icon">🔒</span>
              <h3>发现了一个小秘密</h3>
            </div>
            <div class="modal-body">
              <p class="hint-text">请输入密码解锁隐藏内容</p>
              <p class="hint-subtext">提示：程序员的特殊日子 💻</p>
              <input 
                v-model="password"
                type="password"
                class="password-input"
                placeholder="请输入密码"
                @keyup.enter="checkPassword"
                ref="passwordInput"
              >
              <button class="submit-btn" @click="checkPassword" v-feedback>
                <span v-if="!checking">解锁</span>
                <span v-else class="loading">验证中...</span>
              </button>
              <transition name="shake">
                <p v-if="showError" class="error-message">密码错误，请重试</p>
              </transition>
            </div>
          </div>
        </div>
      </transition>
    </div>
  </div>
</template>

<script setup>
import { ref, nextTick } from 'vue'
import { useRouter } from 'vue-router'
import ParticleBackground from '../components/ParticleBackground.vue'

const router = useRouter()
const showDialog = ref(false)
const password = ref('')
const showError = ref(false)
const checking = ref(false)
const passwordInput = ref(null)

// 直接跳转到1024页面，无需密码
const goToProgrammerDay = () => {
  router.push('/1024')
}

const showPasswordDialog = async () => {
  // 已废弃 - 直接跳转
  goToProgrammerDay()
}

const closeDialog = () => {
  showDialog.value = false
  password.value = ''
  showError.value = false
}

const checkPassword = async () => {
  if (checking.value) return
  
  checking.value = true
  showError.value = false
  
  // 模拟验证延迟
  await new Promise(resolve => setTimeout(resolve, 500))
  
  if (password.value === '1024') {
    // 密码正确，跳转到彩蛋页面
    closeDialog()
    router.push('/1024')
  } else {
    // 密码错误
    showError.value = true
    password.value = ''
    passwordInput.value?.focus()
  }
  
  checking.value = false
}
</script>

<style scoped>
.about-page {
  min-height: 100vh;
  padding: 80px 0;
  position: relative;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 2;
}

.about-header {
  text-align: center;
  margin-bottom: 4rem;
}

.page-title {
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  animation: fadeInUp 0.6s ease;
}

.title-underline {
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  margin: 0 auto;
  border-radius: 2px;
  animation: expandWidth 0.8s ease;
}

@keyframes expandWidth {
  from {
    width: 0;
  }
}

.intro-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.intro-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease;
  animation-fill-mode: backwards;
}

.intro-card:nth-child(1) {
  animation-delay: 0.1s;
}

.intro-card:nth-child(2) {
  animation-delay: 0.2s;
}

.intro-card:nth-child(3) {
  animation-delay: 0.3s;
}

.intro-card:hover {
  transform: translateY(-5px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
}

.icon-wrapper {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.intro-card:hover .icon-wrapper {
  transform: scale(1.1);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
}

.icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.intro-card h2 {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 1rem;
}

.intro-card p {
  color: #a0a9c9;
  line-height: 1.6;
}

.features-section,
.team-section {
  margin-bottom: 4rem;
}

.section-title {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 3rem;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.feature-item {
  text-align: center;
  padding: 1.5rem;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(99, 102, 241, 0.1);
  transition: all 0.3s ease;
}

.feature-item:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(99, 102, 241, 0.3);
}

.feature-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.5));
}

.feature-item h3 {
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

.feature-item p {
  color: #a0a9c9;
  font-size: 0.9rem;
}

.team-intro {
  text-align: center;
  color: #a0a9c9;
  font-size: 1.1rem;
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
}

/* 彩蛋触发器 */
.easter-egg-trigger {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.85;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
  border-radius: 50%;
  border: 2px solid rgba(255, 215, 0, 0.4);
  animation: float 3s ease-in-out infinite, pulse-glow 2s ease-in-out infinite;
  filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
  backdrop-filter: blur(10px);
}

.easter-egg-trigger:hover {
  opacity: 1;
  transform: scale(1.25) rotate(15deg);
  filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.9));
  border-color: rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.7);
  }
}

.hidden-icon {
  font-size: 2rem;
  animation: rotate-slow 4s linear infinite;
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 模态框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: linear-gradient(135deg, #1a1f35, #1e2442);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #a0a9c9;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-header {
  text-align: center;
  margin-bottom: 2rem;
}

.lock-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.modal-header h3 {
  font-size: 1.5rem;
  color: #fff;
  margin: 0;
}

.modal-body {
  text-align: center;
}

.hint-text {
  color: #a0a9c9;
  margin-bottom: 0.5rem;
}

.hint-subtext {
  color: #8892b0;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.password-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  text-align: center;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.password-input:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.password-input::placeholder {
  color: #8892b0;
}

.submit-btn {
  width: 100%;
  padding: 0.8rem 2rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.submit-btn:active {
  transform: translateY(0);
}

.loading {
  display: inline-block;
  animation: pulse 1s ease infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.error-message {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-top: 1rem;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* 过渡动画 */
.modal-fade-enter-active,
.modal-fade-leave-active {
  transition: opacity 0.3s ease;
}

.modal-fade-enter-from,
.modal-fade-leave-to {
  opacity: 0;
}

.shake-enter-active {
  animation: shake 0.5s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .page-title {
    font-size: 2rem;
  }
  
  .intro-section {
    grid-template-columns: 1fr;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    margin: 20px;
    padding: 1.5rem;
  }
}
</style>
